#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <QWebView>

QT_BEGIN_NAMESPACE
class QWidget;
class QWebView;
class QProgressBar;
class QTabWidget;
class QLineEdit;
class QUrl;
class QTabBar;
class QHBoxLayout;
class QLabel;
class QMovie;
QT_END_NAMESPACE

class TabWidget;
class LoadingIndicator;


class MainWindow : public QMainWindow {
	Q_OBJECT

private:

private slots:
	void newTab();
	void closeTab(int);
	void tabChanged(int);

public:
	TabWidget* tabWidget;
	QTabBar* tabBar;

	MainWindow(QWidget *parent = 0);
	~MainWindow();


};

class BrowserTab : public QObject {
	Q_OBJECT

private:

private slots:
	void performBack();
	void performForward();
	void performReload();
	void loadStarted();
	void loadFinished(bool);
	void newLocation();
	void updateLocationBar(QUrl);
	void updateIcon();
	void urlChanged(QUrl);
	void updateTitle(QString);

public:
	MainWindow* mainWindow;
	QWebView* webView;
	QLineEdit* locationBox;
	QWidget* tabPane;
	QHBoxLayout* toolbar;
	LoadingIndicator* loadingIndicator;

	BrowserTab(MainWindow* mainWindow);
	~BrowserTab();

	void init();
	QWidget* getUi();
	void load(QUrl url);
	int getMainTabIndex();
};

class TabWidget : public QTabWidget {
	Q_OBJECT

private:

private slots:

public:
	TabWidget(QWidget* parent = 0);
	~TabWidget();

	void mySetTabBar(QTabBar*);
};

class LoadingIndicator {

private:
	QLabel* label;
	QMovie* movie;

public:
	LoadingIndicator();

	QWidget* getWidget();
	void start();
	void stop();
};

#endif // MAINWINDOW_H
